﻿using SW.Lite.Infrastructure.Common;
using SW.Lite.Model.Master;

namespace SW.Lite.IDAL.Master
{
    public interface IRole
    {
        /// <summary>
        ///     数据是否存在
        /// </summary>
        /// <param name="id">ID</param>
        bool Exists(int id);

        /// <summary>
        ///     获取单个项
        /// </summary>
        /// <param name="id">ID</param>
        RoleModel Single(int id);

        /// <summary>
        ///     获取所有项目
        /// </summary>
        PageList<RoleModel> All();

        /// <summary>
        ///     获取所有项目(分页)
        /// </summary>
        PageList<RoleModel> All(int pageIndex, int pageSize);

        /// <summary>
        ///     插入数据
        /// </summary>
        ExecuteResult Insert(RoleModel item);

        /// <summary>
        ///     更新数据
        /// </summary>
        ExecuteResult Update(RoleModel item);

        /// <summary>
        ///     删除数据
        /// </summary>
        ExecuteResult Delete(params int[] ids);

        /// <summary>
        ///     根据AdminID获取角色列表
        /// </summary>
        /// <param name="adminId">AdminID</param>
        PageList<RoleModel> GetRolesByAdminId(int adminId);

        /// <summary>
        ///     根据编码集合获取角色列表
        /// </summary>
        /// <param name="codes">编码集合</param>
        PageList<RoleModel> GetRolesByCodes(params string[] codes);

        /// <summary>
        ///     保存角色菜单
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <param name="menuIds">菜单ID集合</param>
        ExecuteResult SaveRoleMenus(int roleId, params int[] menuIds);

        /// <summary>
        ///     保存角色按钮
        /// </summary>
        /// <param name="roleId">角色ID</param>
        /// <param name="buttonIds">按钮ID集合</param>
        ExecuteResult SaveRoleButtons(int roleId, params int[] buttonIds);
    }
}